package com.neusoft.ysu.populationmanagement.controller;


import com.neusoft.ysu.populationmanagement.entity.CommonResult;
import com.neusoft.ysu.populationmanagement.entity.Population;
import com.neusoft.ysu.populationmanagement.service.impl.PopulationServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 作者：赵子鉴
 * @since 2024-06-18
 */
@RestController
@RequestMapping("/population")
@CrossOrigin
public class PopulationController {
    @Autowired
    PopulationServiceImpl populationService;
    @RequestMapping("/insert")
    public CommonResult insertPop(Population population) {
        System.out.println("123123");
        return populationService.insertPop(population);
    }
    @RequestMapping("/update")
    public CommonResult updatePop(Population population) {
        return populationService.updatePop(population);
    }
    @RequestMapping("/delete")
    public CommonResult deletePop( Population population) {
        return populationService.deletePop(population);
    }
    @RequestMapping("/selectByAdress")
    public CommonResult selectByAddress(String area) {
        System.out.println(area);
        return populationService.selectByAddress(area);
    }
}
